package com.itany.dao.impl;

import com.itany.dao.DeptDao;
import com.itany.jdbc.jdbc.JDBCTemplate;
import com.itany.mapper.DeptMapper;
import com.itany.pojo.Dept;

import java.util.List;

/**
 * @author 陈华旺
 * @version 1.0
 * @date 2023年11月23日 11:47
 * @Description TODO
 */
public class DeptDaoImpl implements DeptDao {
    private JDBCTemplate jt = new JDBCTemplate();
    private DeptMapper dm = new DeptMapper();

    @Override
    public List<Dept> selectDeptAll() {
        String sql = " select deptno,dname,loc from dept ";
        List<Dept> list = jt.query(sql, dm);
        return list;
    }

    @Override
    public Dept selectDeptByNo(String deptno) {
        String sql = " select deptno,dname,loc from dept where deptno = ? ";
        return jt.queryOne(sql,dm,deptno);
    }
}
